import React, {Component} from 'react'
import {View, Text, Image, TouchableHighlight} from 'react-native'
import NavigatorService from '../../config/navigate_service'
import styles from '../../config/styles'

class VideoAttachment extends Component {
    _url = () => {
        if (this.props.attachment.url.match(/^https:\/\/*/)) {
            return this.props.attachment.url
        } else {
            return App.host + '/api' + this.props.attachment.url
        }
    }

    render () {
        return (
                <View>
                    <TouchableHighlight
                        onPress={() => {NavigatorService.navigate('video_show', {uri: this._url()})}}
                        style={this.props.style}
                    >
                        <Image
                            source={require('../../assets/images/mp4.png')}
                            style={[styles.attachment_view,{marginTop:5}]}
                        />
                    </TouchableHighlight>
                </View>
               
            )
    }
}

export default VideoAttachment